package com.myh.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;

/*
**2020年7月4日--下午12:22:24
**@version:
**莫耀华:
**@Description:
*/
@SpringBootApplication
@EnableEurekaClient //在服务启动后 自动注册到eureka服务中
@EnableDiscoveryClient //服务发现
public class UserProvider_8001 {
	public static void main(String[] args) {
		SpringApplication.run(UserProvider_8001.class, args);
	} 
	//注册servlet
	@Bean
	public ServletRegistrationBean hystrixMetricsStreamServlet() {
		ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
		registrationBean.addUrlMappings("/actuator/hystrix.stream");
		return registrationBean;
	}
}
